package com.campus.app.service.impl;

import com.campus.app.mapper.WxIndexImageMapper;
import com.campus.commons.entity.WxIndexImageType;
import com.campus.app.mapper.WxIndexImageTypeMapper;
import com.campus.app.service.WxIndexImageTypesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.campus.commons.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 轮播页面类型表 服务实现类
 * </p>
 *
 * @author Rin
 * @since 2021-01-30
 */
@Service
public class WxIndexImageTypeServiceImpl extends ServiceImpl<WxIndexImageTypeMapper, WxIndexImageType> implements WxIndexImageTypesService {
@Autowired
private WxIndexImageTypeMapper indexImageTypeMapper;
    @Override
    public Result addIndexImageType(WxIndexImageType wxIndexImageType) {
        int res = indexImageTypeMapper.insert(wxIndexImageType);
        if (res > 0) {
            WxIndexImageType.IndexTypes.put(wxIndexImageType.getId(), wxIndexImageType);
            return Result.success(wxIndexImageType);
        } else {
            return Result.error();
        }

    }

}
